package cn.ecut.mapper;

import cn.ecut.pojo.User;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.support.SqlSessionDaoSupport;
import java.util.List;

/**
 * @Author ruanxin
 */
public class UserMapperImpl extends SqlSessionDaoSupport implements UserMapper{


    @Override
    public List<User> queryAllUser() {
        User user = new User(6, "ui", "0987");
        UserMapper mapper = getSqlSession().getMapper(UserMapper.class);
        mapper.insertUser(user);
        deleteUser(6);
        return mapper.queryAllUser();
    }

    @Override
    public int insertUser(User user) {
        return getSqlSession().getMapper(UserMapper.class).insertUser(user);
    }

    @Override
    public int deleteUser(int id) {
        return getSqlSession().getMapper(UserMapper.class).deleteUser(id);
    }


}
